﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DevScope.SharePoint.Utils.BulkDelete.Helpers
{
    public static class WebHelper
    {
        /// <summary>
        /// URLs the combine.
        /// </summary>
        /// <param name="baseUrlPath">The base URL path.</param>
        /// <param name="additionalNodes">The additional nodes.</param>
        /// <returns></returns>
        public static string UrlCombine(string baseUrlPath, string additionalNodes)
        {
            if (baseUrlPath == null)
            {
                throw new ArgumentNullException("baseUrlPath");
            }
            if (baseUrlPath.Length <= 0)
            {
                throw new ArgumentOutOfRangeException("baseUrlPath");
            }
            if (additionalNodes == null)
            {
                throw new ArgumentNullException("additionalNodes");
            }
            if (additionalNodes.Length <= 0)
            {
                throw new ArgumentOutOfRangeException("additionalNodes");
            }
            bool flag = baseUrlPath.EndsWith("/");
            bool flag2 = additionalNodes.StartsWith("/");
            if (flag && flag2)
            {
                return (baseUrlPath + additionalNodes.Substring(1));
            }
            if ((flag || !flag2) && (!flag || flag2))
            {
                return (baseUrlPath + "/" + additionalNodes);
            }
            return (baseUrlPath + additionalNodes);
        }
    }
}
